<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{$shop['companyname']}</title>
<script src="{MODULE_URL}template/resources/js/jquery-2.1.1.min.js"></script>
<link href="{MODULE_URL}template/resources/js/bootstrap.min.css" rel="stylesheet">
<script src="{MODULE_URL}template/resources/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="{MODULE_URL}template/resources/layui/css/layui.css" media="all">
<script src="{MODULE_URL}template/resources/layui/layui.js"></script>
<link href="{MODULE_URL}template/mobile/store/base.css" rel="stylesheet">
<script src="{MODULE_URL}template/resources/js/swiper.min.js"></script>
<link href="{MODULE_URL}template/resources/js/swiper.min.css" rel="stylesheet">
<style>
html,body{height:100%; overflow:hidden;font-size:12px;}
body{ margin:0;background:url('{MODULE_URL}template/resources/bg.jpg');background-size:cover;}
#login{ margin:100px auto 80px auto; display:block; width:300px;}
h3{ font-size:18px; margin-bottom:30px;}
p{margin-bottom:10px; position:relative;}
.btngroup{}
</style>
</head>
<body>
<div class="loginbox" style="display:none;">
	<form id="login" action="" method="post"  class="layui-form">
       <h3>账号登陆</h3>
       <p><input type="text" name="user" value="{php echo $user}" required lay-verify="required" placeholder="请输入账号" autocomplete="off" class="layui-input"/></p>
       <p><input type="password" name="pass" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input"/></p>
       <p><input type="checkbox" name="isremember" title="记住账号" lay-skin="primary" checked /></p>
       <p><button class="layui-btn" lay-submit lay-filter="formDemo" style="width:100%;">登陆</button></p>
	</form>
</div>

</body>
<script language="javascript">
layui.use(['layer', 'element','form'], function(){
	var layer = layui.layer
	,element = layui.element
	,form = layui.form;
	
	layer.open({
		type: 1,
		title:0,
		anim:1,
		area:"400px",
		closeBtn:0,
		content:$(".loginbox").show(),
		success: function(layero, index){
			form.render('checkbox');
		}
	});
	
	form.on('submit(formDemo)', function(data){
		if(!data.field.user){
			layer.msg("请输入账号");
			return false;
		}
		if(!data.field.pass){
			layer.msg("请输入密码");
			return false;
		}
		var index2=layer.load(1, {shade: [0.1,'#fff']});
		$.post("{php echo $this->createMobileUrl('login',array('op'=>'post'))}",data.field,function(returnstr){
			layer.close(index2);
			console.log(returnstr);
			var result=eval("("+returnstr+")");
			if(result.success){
				//location.href="{php echo $this->createMobileUrl('index')}";
				location.href="{php echo $this->createMobileUrl('index')}"
				return false;
			}else{
				layer.msg(result.msg,{icon:2,time:1000});
				return false;
			}
			
		});
		return false;
	});
});
</script>